<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function time() {
            var day=new Date();
            y=day.getFullYear();
            mo=day.getMonth()+1;
            d=day.getDate();
            ho=day.getHours();
            mi=day.getMinutes();
            se=day.getSeconds();
            str=y+"年"+mo+"月"+d+"日"+ho+"："+mi+"："+se;
            document.getElementById("time").innerHTML=str;
        }
        setInterval(time,"100ms");
    </script>
</head>
<body>
<div id="time" onload="time()"></div><!--onload 加载完毕之后-->

</body>
</html>